package com.deyuanyun.pic.pipe.controller.vo.merge;

import com.deyuanyun.pic.common.util.ObjectUtil;
import com.deyuanyun.pic.pipe.controller.vo.BaseVOUtil;
import com.deyuanyun.pic.pipe.controller.vo.DefaultCommand;
import com.deyuanyun.pic.pipe.domain.bo.BowMergeBO;
import com.deyuanyun.pic.settings.support.biz.PipeLineUtil;
import com.github.pagehelper.Page;

import java.math.BigDecimal;

/**
 * 弯头合并信息：包含热煨弯头 和 冷弯弯头
 */
public class BowMergeVO extends DefaultCommand<BowMergeBO> {

    // 主键
    private String id;
    // 管道ID
    private String pipeLineName;
    // 弯头编号(自定义编号)
    private String bowNumber;
    // 弯头角度
    private BigDecimal elbowAngle;
    // 曲率半径
    private BigDecimal elbowCurvrad;
    // 弯头类型：0，热煨弯头；1，冷弯弯头
    private String bowType;
    // gis地图编号
    private String gisId;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getPipeLineName() {
        return pipeLineName;
    }

    public void setPipeLineName(String pipeLineName) {
        this.pipeLineName = pipeLineName;
    }

    public String getBowNumber() {
        return bowNumber;
    }

    public void setBowNumber(String bowNumber) {
        this.bowNumber = bowNumber;
    }

    public BigDecimal getElbowAngle() {
        return elbowAngle;
    }

    public void setElbowAngle(BigDecimal elbowAngle) {
        this.elbowAngle = elbowAngle;
    }

    public BigDecimal getElbowCurvrad() {
        return elbowCurvrad;
    }

    public void setElbowCurvrad(BigDecimal elbowCurvrad) {
        this.elbowCurvrad = elbowCurvrad;
    }

    public String getBowType() {
        return bowType;
    }

    public void setBowType(String bowType) {
        this.bowType = bowType;
    }

    public String getGisId() {
        return gisId;
    }

    public void setGisId(String gisId) {
        this.gisId = gisId;
    }

    public void fromDomain(BowMergeBO domain) {
        if (ObjectUtil.isEmptyAll(domain)) {
            return;
        }
        // 主键
        this.id = domain.getId();
        // 管道名称
        this.pipeLineName = PipeLineUtil.getPipeLineName(domain.getPipeLineId());
        // 弯头编号
        this.bowNumber = domain.getBowNumber();
        // 弯头角度
        this.elbowAngle = domain.getElbowAngle();
        // 曲率半径
        this.elbowCurvrad = domain.getElbowCurvrad();
        // 弯头类型：0，热煨弯头；1，冷弯弯头
        this.bowType = domain.getBowType();
        // gis地址
        this.gisId = domain.getGisId();
    }

    public Page<BowMergeVO> fromDomainList(Page<BowMergeBO> domainList) {
        Page<BowMergeVO> list = new Page<BowMergeVO>();
        for (BowMergeBO bowMergeBO : domainList) {
            BowMergeVO bowMergeVO = new BowMergeVO();
            bowMergeVO.fromDomain(bowMergeBO);
            list.add(bowMergeVO);
        }
        BaseVOUtil.converterPage(domainList, list);
        return list;
    }
}